#pragma once
#include "interfaces.h"
#include "Geometry.h"
class SceneNodeProperties
{
public:
	SceneNodeProperties() {};
	SceneNodeProperties(ActorId actorid, float radius) : m_ActorId(actorid), m_Radius(radius) {};
	~SceneNodeProperties() {};

	ActorId m_ActorId; // actor id, used to match with other systems representation
	float	m_Radius; // used in scene culling
	Mat4x4 m_ToWorld;
	Mat4x4 m_FromWorld;
	//////////////////////////////////////
	///TODO: Add pass enum later!!
	///////////////////////////////////
};


/////////////////////////////////////////////////////////////////////
//////////
//////////SceneNode; Base impl of ISceneNode iterface.
//////////
//////////
class SceneNode : public ISceneNode
{
public:
	explicit SceneNode(Vec3 pos, Quaternion rot,  bool IsVisible = true) : m_IsVisible(IsVisible) {
		D3DXMatrixRotationQuaternion(&m_Props.m_ToWorld, &rot);
		m_Props.m_ToWorld.SetPosition(pos);
		m_Props.m_FromWorld = m_Props.m_ToWorld.Inverse();
	};
	SceneNode(Mat4x4 World_Mat) : m_IsVisible(true) {
		m_Props.m_ToWorld._11 = World_Mat._11;
		m_Props.m_ToWorld._12 = World_Mat._12;
		m_Props.m_ToWorld._13 = World_Mat._13;
		m_Props.m_ToWorld._14 = World_Mat._14;
		m_Props.m_ToWorld._21 = World_Mat._21;
		m_Props.m_ToWorld._22 = World_Mat._22;
		m_Props.m_ToWorld._23 = World_Mat._23;
		m_Props.m_ToWorld._24 = World_Mat._24;
		m_Props.m_ToWorld._31 = World_Mat._31;
		m_Props.m_ToWorld._32 = World_Mat._32;
		m_Props.m_ToWorld._33 = World_Mat._33;
		m_Props.m_ToWorld._34 = World_Mat._34;
		m_Props.m_ToWorld._41 = World_Mat._41;
		m_Props.m_ToWorld._42 = World_Mat._42;
		m_Props.m_ToWorld._43 = World_Mat._43;
		m_Props.m_ToWorld._44 = World_Mat._44;
		m_Props.m_FromWorld = m_Props.m_ToWorld.Inverse();
	}
	virtual ~SceneNode() {};

	SceneNodeList m_Children;
	SceneNodeWeakPtr m_pParent;
	SceneNodeProperties m_Props;

	bool m_IsVisible;

	virtual SceneNodeList& VGetChildren();
	virtual bool VOnRender(IScene *pScene);
	virtual bool VPreRender(IScene *pScene);
	virtual bool VPostRender(IScene *pScene);
	virtual bool VOnUpdate(float fTime) { return VUpdateChildren(fTime); };
	virtual bool VRenderChildren(IScene *pScene);
	virtual bool VUpdateChildren(float fTime);
	virtual bool VIsVisible();
	virtual bool VAddChild(SceneNodePtr scene_node);
	virtual ActorId VGetId();
};
///////////////////////////////////////////////////////
//////	Camera Scene Node
//////
class CameraNode : public SceneNode
{
public:
	CameraNode(Vec3 pos = Vec3(0,0,0), Quaternion quat = Quaternion(0,0,0,1)) : SceneNode(pos, quat){};
	
	~CameraNode(){};


};
